package cn.wolfcode.wolf2w.spot.controller;

import cn.wolfcode.wolf2w.common.core.domain.R;
import cn.wolfcode.wolf2w.common.security.annotation.InnerAuth;
import cn.wolfcode.wolf2w.spot.api.domain.SpotContext;
import cn.wolfcode.wolf2w.spot.query.SpotContextQuery;
import cn.wolfcode.wolf2w.spot.service.ISpotContextService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 景点内容 Controller
 * 
 * @author dalang
 * @date 2023-11-23
 */
@RestController
@RequestMapping("spotContexts")
public class SpotContextController {
    @Autowired
    private ISpotContextService spotContextService;
    /**
     * 景点内容详情
     */
    @GetMapping("/detail/{id}")
    public R<SpotContext> detail(@PathVariable Long id) {
        SpotContext spotContext = spotContextService.getById(id);
        return R.ok(spotContext);
    }
    /**
     * 景点内容 列表
     */
    @GetMapping("/query")
    public R<IPage<SpotContext>> query(SpotContextQuery qo) {
        IPage<SpotContext> page = spotContextService.queryPage(qo);
        return R.ok(page);
    }

//    /**
//     *
//     */
//    @GetMapping("/detail/{id}")
//    public R<SpotContext> detail(@PathVariable Long id) {
//        SpotContext spotContext = spotContextService.getById(id);
//        return R.ok(spotContext);
//    }


    /*****************************************对外暴露Fegin接口**********************************************/
    /**
     * Feign 接口
     */
    @GetMapping("/feign/list")
    public R<List<SpotContext>> feignList() {
        return R.ok(spotContextService.list());
    }
    @InnerAuth
    @GetMapping("/feign/{id}")
    public R<SpotContext> feignGet(@PathVariable Long id) {
        return R.ok(spotContextService.getById(id));
    }
}
